/* Teach Tool  - Structural Dynamics
 * Copyright (C) 2009: Fabian Gerold, www.fabiangerold.de
 *
 * This file may be licensed under the terms of of the
 * GNU General Public License Version 3 (the "GPL").
 * 
 * Software distributed under the License is distributed 
 * on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
 * express or implied. See the GPL for the specific language 
 * governing rights and limitations.
 *
 * You should have received a copy of the GPL along with this 
 * program. If not, go to http://www.gnu.org/licenses/gpl.html
 * or write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef ISD_EMSWIDGET_H
#define ISD_EMSWIDGET_H

#include <QtGui/QGraphicsView>
class System;
class Mass;
class SpringDamp;
class Force;

class EMSWidget : public QGraphicsView
{
    Q_OBJECT

public:
    EMSWidget( System* sys );

	void dragMass( double dx );
	void releaseMass( double dx );
	void pressMass();
	void setMassDragable( bool dragable );
	
	
	void showGroundMeter();

signals:
	void massDragged( double dx );
	void massReleased( double dx );
	void massPressed();

public slots:
	void slotSetDisp( double disp, double ground_disp );
	void slotResetDisp();
	void slotSetDragDisp( double disp );
	
	void slotSetSpring( double k );
	void slotSetMass( double m );
	void slotSetDamp( double d );

	void slotSetForce( double force );
	void slotSetForceVisible( bool visible );

protected:
	void resizeEvent( QResizeEvent * event );
	QSize sizeHint() const;

private:
	System*		m_system;
	Mass*		m_mass;
	SpringDamp*	m_spring_damp;
	Force*		m_force;
	QGraphicsScene* m_scene;
	bool		m_force_visible;
};

#endif
